﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Data_Show.aspx.cs" Inherits="FPC.Offer.UI.SystemManage.Data_Show" %>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <link href="../H-ui/static/h-ui/css/H-ui.min.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/css/H-ui.admin.css" rel="stylesheet" />
    <link href="../H-ui/Lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/skin/default/skin.css" rel="stylesheet" />
    <link href="../H-ui/static/h-ui.admin/css/style.css" rel="stylesheet" />

    <title>新建网站角色 - 管理员管理 - H-ui.admin v3.0</title>
    <meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
    <meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
    <article class="page-container">
       <form action="/GeneralProcessor/Power/HandlerPower.ashx" method="post" id="Form" name="Form">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>菜单名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="PowerName" name="PowerName">
                </div>
            </div>
           <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">菜单地址：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="PowerAddress" name="PowerAddress">
                </div>
            </div>            
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">备注：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="PowerRemarks" name="PowerRemarks">
                </div>
            </div>     
           <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">选择父级Id：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <select id="PowerSublevelId" name="PowerSublevelId" class="select">
                        <option value="0">无父级菜单</option>
                    </select>
                </div>
            </div>     
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                       <input type="button" onclick="PowerAdd()"  class="btn btn-success radius" value=" 确定"/>
                </div>
            </div>
        </form>
    </article>

    <!--_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="../H-ui/Lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../H-ui/Lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="../H-ui/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="../H-ui/static/h-ui.admin/js/H-ui.admin.js"></script>
    <!--/_footer 作为公共模版分离出去-->
    <!--请在下方写此页面业务相关的脚本-->    
    <script type="text/javascript">

        $(document).ready(function () {
            var url = location.search;
            var geturl = url.substring(url.indexOf("=") + 1);
            if (geturl != "") {
                PowerGetShow(geturl);
            };
            DropDownShow();
        });
        //下拉菜单
        function DropDownShow() {
            $.ajax({
                type: 'post',
                url: '/GeneralProcessor/Power/HandlerPower.ashx',
                data: {
                    Actioon: '<%=FPC.Offer.Common.EnumAction.Select.ToString()%>',
                    GetName: 1,
                },
                success: function (s) {
                    var arr = JSON.parse(s);
                    var tr = new Array();
                    $(arr).each(function (i, obj) {
                        tr.push("<option value=\"" + obj.PowerId + "\">" + obj.PowerName + "</option>");
                    })
                    $("#PowerSublevelId").append(tr.join());

                }
            });
        };

        function PowerGetShow(ss) {
            $.ajax({
                type: 'post',
                url: '/GeneralProcessor/Power/HandlerPower.ashx',
                data: {
                    Actioon: '<%=FPC.Offer.Common.EnumAction.Select.ToString()%>',
                    GetId: ss,
                },
                success: function (s) {
                    var arr = JSON.parse(s);
                    $(arr).each(function (i, obj) {
                        $("#PowerName").val(obj.PowerName);
                        $("#PowerRemarks").val(obj.PowerRemarks);
                        $("#PowerAddress").val(obj.PowerAddress);
                    })

                }
            });
        };
        function PowerAdd() {

            if ($("#PowerName").val() == "") {
                alert("请添加菜单名称！"); return;
            }
            if ($("#PowerRemarks").val() == "") {
                alert("请选择菜单备注！"); return;
            }
            if ($("#PowerAddress").val() == "") {
                alert("请选择菜单备注！"); return;
            }           

            var url = location.search;
            var geturl = url.substring(url.indexOf("=") + 1);
            var Addurl = "";
            if (geturl.length > 0) {
                Addurl = '<%=FPC.Offer.Common.EnumAction.Update.ToString()%>';
            }
            else {
                Addurl = '<%=FPC.Offer.Common.EnumAction.Add.ToString()%>';
            }
            var getajax = {
                type: 'post',
                url: '/GeneralProcessor/Power/HandlerPower.ashx',
                data: {
                    Actioon: Addurl,
                    PowerId: geturl,
                },
                success: function (s) {
                    if (parseInt(s) > 0) {
                        alert("操作成功"); layer_close(); location.reload();
                    } else {
                        alert("操作失败");
                    }
                }
            };
            if ($("#PowerName").val() != "" && $("#PowerRemarks").val() != "" && $("#PowerAddress").val() != "") {
                $("#Form").ajaxSubmit(getajax)
            }
            else {
                alert("信息填写不完整！")
            }
        };
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
</body>
</html>